package com.lemon.cloud.gray.feign;

import com.lemon.cloud.gray.support.GrayFlagContextHolder;
import feign.InvocationContext;
import feign.ResponseInterceptor;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

@Slf4j
public class GrayFeignResponseInterceptor implements ResponseInterceptor {

//    @Override
//    public Object aroundDecode(InvocationContext invocationContext) throws IOException {
//        GrayFlagContextHolder.clear();
//        return ResponseInterceptor.DEFAULT.aroundDecode(invocationContext);
//    }

    @Override
    public Object intercept(InvocationContext invocationContext, Chain chain) throws Exception {
        GrayFlagContextHolder.clear();
        return chain.next(invocationContext);
    }
}
